/* Includes ------------------------------------------------------------------*/
#include "wb32l003.h"
#include <stdio.h>
#include "MACRO.H"
#include "VALUE_SET.H"
#include "IO_SETUP.H"


TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure;
/*********************************************************************/
void TIMER1_Init(void)
{/* Enable TIM1 Clock */
	RCC_APBPeriphClockCmd(RCC_APBPeriph_TIM1, ENABLE);
	TIM_DeInit(TIM1);
	NVIC_SetPriority(TIM1_IRQn, 1);
	NVIC_EnableIRQ(TIM1_IRQn);
	TIM_ARRPreloadConfig(TIM1, DISABLE);
 
	/* Time base configuration */
	//TIM_TimeBaseInitStructure.TIM_Period = 60000; // 1/24000000*4*60000=10mS
	TIM_TimeBaseInitStructure.TIM_Period = 6000; // 1/24000000*4*6000=1mS
	TIM_TimeBaseInitStructure.TIM_Prescaler = 3;
	TIM_TimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV4;
	TIM_TimeBaseInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
	TIM_TimeBaseInitStructure.TIM_RepetitionCounter = 0;
	TIM_TimeBaseInit(TIM1, &TIM_TimeBaseInitStructure);
	TIM_ARRPreloadConfig(TIM1, ENABLE);
	TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE);
	TIM_Cmd(TIM1, ENABLE);
}
